package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.SetmealDish;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /*
    根据id查询是否与套餐关联
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishid);
    /*
    套餐与菜品关联的表
     */
    void insertBatch(List<SetmealDish> setmealDishes);
    /*
    分页查询
     */
    Page<SetmealVO> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);
    /*
    批量删除
     */
    void deleteBySetmealIds(List<Long> ids);
    /*
    根据id查找关联表的集合
     */
    @Select("select * from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> getBySetmealId(Long id);

    /*
    根据id删除关联表中的套餐菜品
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    void deleteBySetmealId(Long setmealId);


}
